﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using System.IO;

public class ManagerWindow : EditorWindow
{
    [MenuItem("Manager/RegisterPool")]
    static void CreatWindow()
    {
        ManagerWindow window = EditorWindow.GetWindow<ManagerWindow>("创建对象池");
        window.Show();//显示窗口
    }
    private string ObjectName = "";
    private string MaxCount = "";
    private void OnGUI()
    {
        ObjectName = EditorGUILayout.TextField("对象名字", ObjectName);
        MaxCount = EditorGUILayout.TextField("对象池大小", MaxCount);
        if (GUILayout.Button("创建对象池"))
        {
            // 保存信息 写入文件
            FileInfo fileinfo = new FileInfo(PoolsText.Path);
            StreamWriter aw = fileinfo.AppendText();
            aw.WriteLine(ObjectName + "," + MaxCount);
            aw.Dispose();
            aw.Close();

           
            EditorUtility.DisplayDialog("提示", "创建成功！！！", "确定");
        }
    }
}
